/**
 * @file common.h
 * @author MaxwellWang
 * @brief 
 * @version v1.0.0
 * @date 2025/11/24
 * @copyright Copyright (c) 2025
 * this file is part of the mw-iap firmware
*/
#ifndef COMMON_H_
#define COMMON_H_


#include    "main.h"

#define UartCH  CW_UART1

#define EnterUartScanByte   0x100000    //启动时候扫描uart一个byte的最大时间
#ifndef packMaxLen
#define packMaxLen  1024        //每次传输1K数据  128*512 page is 512byte

#endif

//获取char from uart
uint8_t GetCharFromUart(uint8_t *key);
void PutCharFromUart(uint8_t c);
void PutStringFromUart(uint8_t *s);
uint8_t Receive_Byte(uint8_t *c,uint32_t timeOut);
int Receive_Packet(uint8_t *data,int32_t *len,uint32_t timeOut);
uint8_t IsEnterBootloader(void);
void sendStartIAP(void);    //启动iap升级
void ScanUpdatePack(void);  //扫描升级数据

#endif // !1
